<!-- Derived from https://gist.github.com/MAKIO135/eab7b74e85ed2be48eeb -->
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>xterm.js example</title>
</head>
<body style="background:#fff;">

<script src="https://unpkg.com/three@latest"></script>
<script src="https://unpkg.com/chalkie@latest"></script>
<script src="https://unpkg.com/xterm@latest/dist/xterm.js"></script>
<link rel="stylesheet" href="https://unpkg.com/xterm@latest/dist/xterm.css" />

<div id="renderer">
</div>

<div id="terminal">
</div>

<script>
  term = new Terminal();
  term.open(document.getElementById('terminal'));
  term.resize(32,16);
  term.write(`${chalk.red("Hello")} from ${chalk.bold.underline.bgCyanBright.black('xterm.js')} !`);
</script>

<script>
var width = window.innerWidth, height = window.innerHeight;
canvas = document.getElementsByClassName("xterm-text-layer")[0];

var camera, scene, renderer, geometry, texture, mesh;

function init() {
    renderer = new THREE.WebGLRenderer();
    renderer.setSize(width, height);
    document.getElementById('renderer').appendChild(renderer.domElement);
    
    scene = new THREE.Scene();
    scene.background = new THREE.Color( 0xff0000 );
  
    camera = new THREE.PerspectiveCamera(70, width / height, 1, 1000);
    camera.position.z = 300;
    scene.add(camera);

    texture = new THREE.CanvasTexture(canvas);
    texture.generateMipmaps = false;
    texture.wrapS = texture.wrapT = THREE.ClampToEdgeWrapping;
    texture.minFilter = THREE.LinearFilter;
    var material = new THREE.MeshBasicMaterial({ map: texture });
    geometry = new THREE.BoxGeometry( 200, 200, 200 );
    mesh = new THREE.Mesh( geometry, material );
    scene.add( mesh );
}

function animate() {
    requestAnimationFrame(animate);
  
    texture.needsUpdate = true;
    mesh.rotation.y += 0.01;
    renderer.render(scene, camera);
}

init();
animate();
</script>

</body>
</html>

